<script type="text/javascript">
window.history.forward(1);
</script>
<div class="topBar">
	<p style="font-size:0.9em;margin:0px;">
		所在城市：<span>上海市</span>
		<a href="javascript:void(0);" onclick="javascript:position();return false;">[定位]</a>
	</p>
</div>

<div class="clear"></div>
<div class="city_input">
    <form method="GET" action="/address">
	<span class="search">
		<input type="hidden" name="tig" value="search">
		<input type="text" class="searchKey" style="font-size:0.9em;" name="k" value="<?php echo $this->key; ?>" placeholder="请输入小区或自提点"/>
		<input type="submit" class="btn2"  value="搜索"/>
	</span>
	</form>
</div>


<div id="wrapperAddress" class="wrapperComman" style="top:100px;bottom:0px;">
<div class="scroller">
<div id="position_list"></div>

<?php 
	if(!empty($this->tig)&& $this->tig =='ziti' && empty($this->zitiList)){
	echo '
	<div style="text-align:center;padding:5px;">亲，该地区暂时没有自提点哦！</div>';
	}
	
	if(!empty($this->zitiList)){
		echo '<div class="my_address">请选择自提点</div>';
		foreach($this->zitiList as $l){
			echo '<a href="javascript:void(0);" onclick="javascript:domainOnClick(this);return false;" domainId="'.$l->id.'" domainName="'.$l->domainname.'" domainAdd ="'.$l->address.'"><div class="address_list">'.$l->domainname.'<br><span>'.$l->address.'</span></div></a>';
		}
	}

?>


<div class="history"></div>
<div class="location_domain"></div>
<div class="clear"></div>
<?php
if (empty($this->result) && empty($this->zitiList)) {
  echo '<div class="html_bg"><img src="/images/position_sel.jpg"></div>';
}

echo '<div id="searchRes">';
if(!empty($this->result)){
	echo '
	<div class="my_address">请选择配送的小区</div>
	  <div class="list">
	  ';
	  if(empty($this->result)){
		echo '该小区暂无搜索结果';
	  }else{
		  foreach($this->result as $r){
			echo '<a class="domainId" href="javascript:void(0);" onclick="javascript:domainOnClick(this);return false;" domainId="'.$r->id.'" domainName="'.$r->domainname.'" domainAdd ="'.$r->address.'"><div class="address_list">'.$r->domainname.'<br><span>'.$r->address.'</span></div></a>';
		  }
	  }
	echo '
	  </div>
	  ';
	echo '<script type="text/javascript">$(".history").hide();</script>';
} 
echo '</div>';

?>
</div>
</div>
<input type="hidden" id="lenLocation" value="">

<div id="position_msg">
	<div id="positioning"><div style="width:65px;margin:0px auto;">定位中<span id="dian">...</span></div></div>
</div>
<script type="text/javascript">

$(document).ready(function(){
	loadDomain();
	resetCartList();
	var myScrollAddress;
	myScrollAddress = new iScroll('wrapperAddress', { scrollbarClass: 'myScrollbar' });
	var cou =0;
	$('#position_list').bind('DOMNodeInserted', function(e) {
	   cou++;
	   if(cou == $('#lenLocation').val()){
			myScrollAddress.destroy();
			myScrollAddress = '';
			setTimeout(function () {
				myScrollAddress = new iScroll('wrapperAddress', { scrollbarClass: 'myScrollbar' });
			}, 100);
			myScrollAddress.refresh();
			myScrollAddress.scrollTo(0,0);
	   }
	});
});
</script>